<template>
	<wsPage :title="pageTitle+'banner'">
		<div slot="page_operate">
			<Button  @click="goback()"><Icon type="close"></Icon><span>关闭</span></Button>
		</div>
		<div class="edit-button-self">
			<Button :type="activeIndex == 0 ? 'primary' : ''" @click="handleOutLink()">外部链接</Button>
			<Button :type="activeIndex == 1 ? 'primary' : ''" @click="handleInsideLink()">本地链接</Button>
			<!-- <Button autofocus @click="handleOutLink()" class="outLink" id="outLinkcss">外部链接</Button>
			<Button @click="handleInsideLink()">本地链接</Button> -->
		</div>

		<!--编辑界面-->
		<Form :model="bannerForm" ref="bannerForm" :rules="validate" :label-width="100">
			<Row>
				<Col :span="12">
					<FormItem prop="title" label="标题">
	            		<Input v-model="bannerForm.title" placeholder="请输入标题" class="ws-form-select"></Input>
	            	</FormItem>
				</Col>
				<Col :span="12">
					<FormItem label="URL" prop="url" v-if="isShowUrl==1">
	            		<Input v-model="bannerForm.url" placeholder="请输入链接URL" class="ws-form-select"></Input>
	            	</FormItem>
				</Col>
			    <Col :span="12">
			    	<Col span="4">
	                	<FormItem label="推广图片" prop="fileId">
			            	<ws-cropper :imageSrc="bannerForm.fileId" cropperId="cropper.id" :fixed="cropper.fixed" :fixedNumber="cropper.fixedNumber" :dialogTitle="cropper.title" @uploadSuccessEvent="uploadSuccessEvent1"></ws-cropper>
			            </FormItem>
		            </Col>
		            <Col span="8">
		            	<FormItem>
			            	<img :src="'/ws/img/view/'+bannerForm.fileId" v-if="bannerForm.fileId!=null && bannerForm.fileId!=''" style="width:160px; overflow:hidden;">
			            </FormItem>
		            </Col>
		            <!-- <FormItem label="图片" prop="fileId">
			        	<div class="demo-upload-list" v-if="bannerForm.fileId">
					        <template>
					            <img :src="'/ws/img/view/'+bannerForm.fileId">
					            <div class="demo-upload-list-cover">
					                <Icon type="ios-trash-outline" @click.native="handleRemove(bannerForm.fileId)"></Icon>
					            </div>
					        </template>
					    </div>
	                    <Upload v-show="!bannerForm.fileId" ref="upload"
					        :show-upload-list="false"
					        :default-file-list="defaultList"
					        :on-success="handleSuccess"
					        :format="['jpg','jpeg','png']"
					        :max-size="2048"
					        :on-format-error="handleFormatError"
					        :on-exceeded-size="handleMaxSize"
					        type="drag"
					        action="/ws/batch/upload"
					        style="display: inline-block;width:80px;">
					        <div style="width: 80px;height:80px;line-height: 80px;">
					            <Icon type="camera" size="24"></Icon>
					        </div>
					    </Upload>
			        </FormItem> -->
				</Col>
			</Row>
			<div style="width:100%; border:0.5px double #E0E0E0;"></div>
			<Tabs @on-click="changeSelectLocalLinkType" v-if="tabshow==1">
	       		
	       		<TabPane label="基地" name=1>
	       			<template>
						<Table highlight-row :columns="baseTable.columns" :data="baseTable.data" @on-current-change="setCurrent"></Table>
						<Page class="page-position" :total="baseTable.page1.total" :show-total=true :current="baseTable.page1.pageNum" :page-size="baseTable.page1.pageSize" @on-change="pageChange1"></Page>
				 	</template>
	       		</TabPane>
	       		<TabPane label="资讯" name=2>
	       			<template>
						<Table highlight-row :columns="contentTable.columns" :data="contentTable.data" @on-current-change="setCurrent"></Table>
						<Page class="page-position" :total="contentTable.page2.total" :current="contentTable.page2.pageNum" :page-size="contentTable.page2.pageSize" :show-total=true @on-change="pageChange2"></Page>
				 	</template>
	       		</TabPane>
	       		<TabPane label="商品" name=3>
	       			<template>
						<Table highlight-row :columns="productTable.columns" :data="productTable.data" @on-current-change="setCurrent"></Table>
						<Row>
						<Page class="page-position" :total="productTable.page3.total" :current="productTable.page3.pageNum" :page-size="productTable.page3.pageSize" :show-total=true @on-change="pageChange3"></Page>
						</Row>
				 	</template>
	       		</TabPane>
	       		<TabPane label="健康项目" name=4>
	       			<template>
						<Table highlight-row :columns="medicalServicesTable.columns" :data="medicalServicesTable.data" @on-current-change="setCurrent"></Table>
						<Page class="page-position" :total="medicalServicesTable.page4.total" :current="medicalServicesTable.page4.pageNum" :page-size="medicalServicesTable.page4.pageSize" :show-total=true @on-change="pageChange4"></Page>
				 	</template>
	       		</TabPane>
	       		<TabPane label="健康项目预约" name=5>
	       			<template>
						<Table highlight-row :columns="organizationTable.columns" :data="organizationTable.data" @on-current-change="setCurrent"></Table>
						<Page class="page-position" :total="organizationTable.page5.total" :current="organizationTable.page5.pageNum" :page-size="organizationTable.page5.pageSize" :show-total=true @on-change="pageChange5"></Page>
				 	</template>
	       		</TabPane>
	       		<TabPane label="视频" name=6>
	       			<template>
						<Table highlight-row :columns="memberTable.columns" :data="memberTable.data" @on-current-change="setCurrent"></Table>
						<Page class="page-position" :total="memberTable.page6.total" :current="memberTable.page6.pageNum" :page-size="memberTable.page6.pageSize" :show-total=true @on-change="pageChange6"></Page>
				 	</template>
	       		</TabPane>
	        </Tabs>
			<div class="edit-button-self">
				<Button type="primary" @click="bannerModalOk">保存</Button>
				<Button @click="goback">取消</Button>
			</div>
		</Form>
	</wsPage>
</template>

<script>
	import Common from '../../../common/common.js';

 	export default {
		data() {
  			return {
  				pageTitle:'新增',
  				activeIndex: 0,
  				//截图工具
            	cropper:{
                    id:'1',
                    title:'截图组件',
                    fixed: true,
                    fixedNumber: [16,9]
                },
                bannerId: null,
                selectLocalLinkType: 0,
                queryForm: {
                	name: ''
                },
                paramsBase: {
                	name: ''
                },
                paramsContent: {
                	name: ''
                },
                paramsProduct: {
                	name: '',
                	status: null
                },
                paramsMedicalServices: {
                	name: ''
                },
                paramsMedicalServicesOrganization: {
                	name: ''
                },
                paramsMember: {
                	name: ''
                },
                selectBannerVO:null,
                isShowUrl: 1,
                tabshow: 0,
                copyUrl: '',
                //基地
				baseTable: {
					columns: [{
						title: '名称',
                        key: 'name',
                        align: 'center'
					},
					{
						title: '地址',
                        key: 'address',
                        align: 'center'
					}],
					data: [],
					page1: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					currentRow: [], //选中
				},
				//资讯
				contentTable: {
					columns: [{
						title: '名称',
                        key: 'name',
                        align: 'center'
					},
					{
						title: '栏目',
                        key: 'columnName',
                        align: 'center'
					}],
					data: [],
					page2: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					currentRow: [], //选中
				},
				//商品
				productTable: {
					columns: [{
						title: '名称',
                        key: 'name',
                        align: 'center'
					},
					{
						title: '所属分类',
                        key: 'catagoryName',
                        align: 'center'
					}],
					data: [],
					page3: {
						total: 0, 		//总条数
						pageNum: 1, 	//当前页
						pageSize: 10 	//每页显示条数
					},
					currentRow: [], 	//选中
				},
				//健康项目
				medicalServicesTable: {
					columns: [{
						title: '名称',
                        key: 'name',
                        align: 'center'
					},
					{
						title: '所属分类',
                        key: 'servicesCategoryName',
                        align: 'center'
					}],
					data: [],
					page4: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					currentRow: [], //选中
				},
				//健康项目机构
				organizationTable: {
					columns: [{
						title: '健康项目名称',
                        key: 'medicalServicesName',
                        align: 'center'
					},
					{
						title: '所属机构名称',
                        key: 'serviceOrganizationName',
                        align: 'center'
					}],
					data: [],
					page5: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					currentRow: [], //选中
				},
				//我的会员
				memberTable: {
					columns: [{
						title: '名称',
                        key: 'name',
                        align: 'center'
					}],
					data: [],
					page6: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					currentRow: [], //选中
				},
				//编辑界面数据
				bannerDataModal: {
					show: false,
					bannerDataForm: {
						id: null,
					}
				},
				bannerForm: {
					id: null,
					title: '',
					url: '',
					fileId: '',
					moduleId: null,
					moduleType: null,
					bannerType: null
				},
				validate: {
					title: [
						{ required: true, message: '请输入标题', trigger: 'blur' },
						{ min: 1, max: 30, message: '长度在 0 到 30 个字符', trigger: 'blur' }
					],
					url: [
						{ required: true, message: '请输入链接URL地址', trigger: 'blur' },
						{ min: 1, max: 128, message: '长度在 0 到 128 个字符', trigger: 'blur' },
						{ validator: Common.validateUrl, trigger: 'blur'}
					],
					fileId: [
						{ required: true, message: '请上传图片', trigger: 'blur' }
					]
				}
 			}
  		},
  		computed: {
			/**
			 * 表格行是否为选中状态
			 */
			isTableSelected() {
				return this.table.currentRow.length > 0;
			},
			isEdit() {
		      return !Util.vad.isBlank(this.bannerDataModal.id);
		    }
		},
  		mounted() {
			this.init();
		},
		methods: {
			init(){
				if(this.$route.query.id != null && this.$route.query.id != '') {
					this.pageTitle='编辑';
					this.bannerId = this.$route.query.id;
					this.queryById(this.bannerId);
				} else {
					this.pageTitle='新增';
					this.editClear();
				}
				
			},
  			/**
        	 * 图片上传成功事件
        	 */
            uploadSuccessEvent1(fileId){
                this.bannerForm.fileId = fileId;
            },
            /**
             * 返回列表页面 
             */
    	 	goback(){
    	 		this.$router.push({name: 'ops_banner_list'});
    	 	},
    	 	/**
    	 	 * 分页改变事件
    	 	 */
    	 	pageChange1(val){
    	 		this.baseTable.page1.pageNum = val;
    	 		this.handleBaseArea();
    	 	},
    	 	pageChange2(val){
    	 		this.contentTable.page2.pageNum = val;
    	 		this.handleArticle();

    	 	},
    	 	pageChange3(val){
    	 		this.productTable.page3.pageNum = val;
    	 		this.handleProduct();
    	 	},
    	 	pageChange4(val){
    	 		this.medicalServicesTable.page4.pageNum = val;
    	 		this.handleMedicalServices();
    	 	},
    	 	pageChange5(val){
    	 		this.organizationTable.page5.pageNum = val;
    	 		this.handleMedicalServicesOrganization();
    	 	},
    	 	pageChange6(val){
    	 		this.memberTable.page6.pageNum = val;
    	 		this.handleMember();
    	 	},
    	 	
			/**
			 * 清空表单
			 */
			editClear(){
				this.bannerForm.title='';
				this.bannerForm.bannerType=null;
				this.bannerForm.moduleType=null;
				this.bannerForm.moduleId=null;
				this.bannerForm.url='';
				this.bannerForm.fileId='';
			},
			/**
			 * 图片上传事件
			 */
			// handleRemove (file) {
   //              this.bannerForm.fileId = null;
   //          },
			/**
    	 	 * 保存操作
    	 	 */
    	 	 bannerModalOk(){
    	 	 	this.$refs['bannerForm'].validate((valid) => {
					if (valid) {
						if(this.bannerId) {
							this.editDataDict();
						} else {
							this.saveDataDict();
						}                    
                    } else {
                        this.$Message.error('表单验证失败!');
                    }
               });
    	 	 },
			/**
			 * 外部链接按钮
			 */
			handleOutLink(){
				this.isShowUrl = 1;
				this.tabshow = 0;
				this.bannerForm.url = this.copyUrl;
				this.bannerForm.bannerType = 1;
				this.bannerForm.moduleType = 0;
				this.activeIndex = 0;
			},
			/**
			 * 本地链接按钮
			 */
			handleInsideLink(){
				this.activeIndex = 1;
				this.changeSelectLocalLinkType(1);
				this.titles = '';					//选中数据标题
				this.tabshow = 1;
				this.queryDataPage();				//跳转查询方法
				this.isShowUrl = 0;				//隐藏URL输入框
				this.copyUrl = this.bannerForm.url;//url值赋值给中间变量
				this.bannerForm.url = '';			//本地链接设置url为空
				this.bannerForm.bannerType = 2;
			},
  			/**
  			 * 修改本地链接选中类型
  			 */
  			changeSelectLocalLinkType(tab, event){
  				this.selectLocalLinkType = Number(tab);
				this.queryDataPage();  				
  			},
  			/**
  			 * 条件查询
  			 */
  			queryFun(){
				this.queryDataPage();
			},
  			/**
  			 * 重新根据选中类型查询分页数据
  			 */
  			queryDataPage(){
  				switch(this.selectLocalLinkType){
				case 1:
					if(typeof this.queryForm.name != 'undefined' && null != this.queryForm.name && '' != this.queryForm.name){
						this.paramsBase.name = this.queryForm.name;
					}else{
						this.paramsBase.name = '';
					}
					this.handleBaseArea();
					this.queryReset(); 
				  	break;
				case 2:
					if(null != this.queryForm.name && '' != this.queryForm.name && typeof this.queryForm.name != 'undefined'){
						this.paramsContent.name = this.queryForm.name;
					}else{
						this.paramsContent.name = '';
					}
					this.handleArticle();
					this.queryReset();
				  	break;
				case 3:
					if(null != this.queryForm.name && '' != this.queryForm.name && typeof this.queryForm.name != 'undefined'){
						this.paramsProduct.name = this.queryForm.name;
					}else{
						this.paramsProduct.name = '';
					}
				  	this.handleProduct();
				  	this.queryReset();
				  	break;
				case 4:
					if(null != this.queryForm.name && '' != this.queryForm.name && typeof this.queryForm.name != 'undefined'){
						this.paramsMedicalServices.name = this.queryForm.name;
					}else{
						this.paramsMedicalServices.name = '';
					}
				  	this.handleMedicalServices();
				  	this.queryReset();
				  	break;	
				case 5:
					if(null != this.queryForm.name && '' != this.queryForm.name && typeof this.queryForm.name != 'undefined'){
						this.paramsMedicalServicesOrganization.name = this.queryForm.name;
					}else{
						this.paramsMedicalServicesOrganization.name = '';
					}
				  	this.handleMedicalServicesOrganization();
				  	this.queryReset();
				  	break;	
				case 6:
					if(null != this.queryForm.name && '' != this.queryForm.name && typeof this.queryForm.name != 'undefined'){
						this.paramsMember.name = this.queryForm.name;
					}else{
						this.paramsMember.name = '';
					}
				  	this.handleMember();
				  	this.queryReset();
				  	break;	
				 }
  			},
  			/**
  			 * 本地链接选中一行数据展示选中标题
  			 */
  			handleBaseChange(val){
  				this.selectBannerVO = val;
  				switch(this.selectLocalLinkType){
					case 1:
					  	if(null != this.selectBannerVO &&　'' != this.selectBannerVO){
						  	this.titles = this.selectBannerVO.name;
					  	}else{
					  		this.titles = '';
					  	}
					  	break;
					case 2:
						if(null != this.selectBannerVO && '' != this.selectBannerVO){
						  	this.titles = this.selectBannerVO.title;
						}else{
							this.titles = '';
						}
					  	break;
					case 3:
						if(null != this.selectBannerVO && '' != this.selectBannerVO){
						  	this.titles = this.selectBannerVO.name;
						}else{
							this.titles = '';
						}
					  	break; 	
					}
  			},
  			/**
  			 * 本地链接确定按钮带入数据
  			 */
			setCurrent(row){
				this.selectBannerVO = row;
				this.isShowUrl == 0;
				switch(this.selectLocalLinkType){
					case 1:
						this.bannerForm.moduleId = this.selectBannerVO.id
						this.bannerForm.title = this.selectBannerVO.name;
						this.bannerForm.moduleType = 1;
						this.bannerForm.bannerType = 2;
					  	break;
					case 2:
						this.bannerForm.moduleId = this.selectBannerVO.id;
						this.bannerForm.moduleType = 2;
						this.bannerForm.title = this.selectBannerVO.name;
						this.bannerForm.bannerType = 2;
					  	break;
					case 3:
						this.bannerForm.moduleId = this.selectBannerVO.id;
						this.bannerForm.title = this.selectBannerVO.name;
						this.bannerForm.moduleType = 3;
						this.bannerForm.bannerType = 2;
					  	break; 	
					case 4:
						this.bannerForm.moduleId = this.selectBannerVO.id;
						this.bannerForm.title = this.selectBannerVO.name;
						this.bannerForm.moduleType = 4;
						this.bannerForm.bannerType = 2;
					  	break;
					case 5:
						this.bannerForm.moduleId = this.selectBannerVO.id;
						this.bannerForm.title = this.selectBannerVO.medicalServicesName+"-"+this.selectBannerVO.serviceOrganizationName;
						this.bannerForm.moduleType = 5;
						this.bannerForm.bannerType = 2;
					  	break;
					case 6:
						this.bannerForm.moduleId = -1;
						this.bannerForm.title = this.selectBannerVO.name;
						this.bannerForm.moduleType = 6;
						this.bannerForm.bannerType = 2;
					  	break;
					}
			},
			/**
			 * 查询本地基地信息
			 */
			handleBaseArea(){
				//发送查询请求
				let pageSize = this.baseTable.page1.pageSize;
				let pageNum = this.baseTable.page1.pageNum;
				this.contentTable.page2.pageNum = 1;
				this.productTable.page3.pageNum = 1;
				const _this = this;
		        this.axios.post('/ws/ops/bases?pageNum='+pageNum+'&pageSize='+pageSize, _this.paramsBase).then(function (response) {
					var res = response.data;
			        var resMeta = res.meta;
			        if(0 == resMeta.code) {
			          	_this.buildPageBaseData(res.data);
			        } else {
			        	_this.$Message.warning(resMeta.message);
			        }
		        });
			},
			/**
			 * 构建表格数据
			 */
			buildPageBaseData(data_) {
				this.baseTable.data = data_.list;
				this.baseTable.page1.total = data_.total;
			},
			/**
			 * 查询本地新闻信息
			 */
			handleArticle(){
				
				let pageSize = this.contentTable.page2.pageSize;
				let pageNum = this.contentTable.page2.pageNum;
				this.baseTable.page1.pageNum = 1;
				this.productTable.page3.pageNum = 1;
				const _this = this;
				//发送查询请求
		        this.axios.post('/ws/ops/contents?pageNum=' + pageNum + '&pageSize=' + pageSize, _this.paramsContent).then(function (response) {
					var res = response.data;
			        var resMeta = res.meta;
			        if(0 == resMeta.code) {
			          	_this.buildPageContentData(res.data);
			        } else {
			          	_this.$Message.warning(resMeta.message);
			        }
		        });
			},
			/**
			 * 构建表格数据
			 */
			buildPageContentData(data_) {
				this.contentTable.data = data_.list;
				this.contentTable.page2.total = data_.total;
			},
			/**
			 * 查询本地产品信息
			 */
			handleProduct(){
				//发送查询请求
				this.paramsProduct.status=4;
				let pageSize = this.productTable.page3.pageSize;
				let pageNum = this.productTable.page3.pageNum;
				this.contentTable.page2.pageNum = 1;
				this.baseTable.page1.pageNum = 1;
				const _this = this;
		        this.axios.post('/ws/ms/products?pageNum=' + pageNum + '&pageSize=' + pageSize, this.paramsProduct).then(function (response) {
					var res = response.data;
			        var resMeta = res.meta;
			        if(0 == resMeta.code) {
			          	_this.buildPageProductData(res.data);
			        } else {
			          	_this.$Message.warning(resMeta.message);
			        }
		        });
			},
			/**
			 * 构建表格数据
			 */
			buildPageProductData(data_) {
				this.productTable.data = data_.list;
				this.productTable.page3.total = data_.total;
			},
			
			/**
			 * 查询本地健康项目信息
			 */
			handleMedicalServices(){
				//发送查询请求
				let pageSize = this.medicalServicesTable.page4.pageSize;
				let pageNum = this.medicalServicesTable.page4.pageNum;
				this.baseTable.page1.pageNum = 1;
				this.contentTable.page2.pageNum = 1;
				this.productTable.page3.pageNum = 1;
				this.organizationTable.page5.pageNum = 1;
				this.memberTable.page6.pageNum = 1;
				const _this = this;
		        this.axios.post('/ws/ops/medicalServicess/banner?pageNum=' + pageNum + '&pageSize=' + pageSize, this.paramsMedicalServices).then(function (response) {
					var res = response.data;
			        var resMeta = res.meta;
			        if(0 == resMeta.code) {
			          	_this.buildPageMedicalServicesData(res.data);
			        } else {
			          	_this.$Message.warning(resMeta.message);
			        }
		        });
			},
			/**
			 * 构建表格数据
			 */
			buildPageMedicalServicesData(data_) {
				this.medicalServicesTable.data = data_.list;
				this.medicalServicesTable.page4.total = data_.total;
			},
			
			/**
			 * 查询本地健康项目机构信息
			 */
			handleMedicalServicesOrganization(){
				//发送查询请求
				let pageSize = this.organizationTable.page5.pageSize;
				let pageNum = this.organizationTable.page5.pageNum;
				this.baseTable.page1.pageNum = 1;
				this.contentTable.page2.pageNum = 1;
				this.productTable.page3.pageNum = 1;
				this.medicalServicesTable.page4.pageNum = 1;
				this.memberTable.page6.pageNum = 1;
				const _this = this;
		        this.axios.post('/ws/ops/medicalServicesOrganizationRelations/banner?pageNum=' + pageNum + '&pageSize=' + pageSize, this.paramsMedicalServicesOrganization).then(function (response) {
					var res = response.data;
			        var resMeta = res.meta;
			        if(0 == resMeta.code) {
			          	_this.buildPageOrganizationData(res.data);
			        } else {
			          	_this.$Message.warning(resMeta.message);
			        }
		        });
			},
			/**
			 * 构建表格数据
			 */
			buildPageOrganizationData(data_) {
				this.organizationTable.data = data_.list;
				this.organizationTable.page5.total = data_.total;
			},
			
			/**
			 * 查询本地会员信息
			 */
			handleMember(){
				//发送查询请求
				let pageSize = this.memberTable.page6.pageSize;
				let pageNum = this.memberTable.page6.pageNum;
				this.baseTable.page1.pageNum = 1;
				this.contentTable.page2.pageNum = 1;
				this.productTable.page3.pageNum = 1;
				this.medicalServicesTable.page4.pageNum = 1;
				this.organizationTable.page5.pageNum = 1;
				this.buildPageMemberData();
			},
			/**
			 * 构建表格数据
			 */
			buildPageMemberData() {
				this.memberTable.data=[];
				this.memberTable.data.push({
					"name":"链接到我的会员"
				});
				this.memberTable.page6.total = 1;
			},
		    /**
		     * 重置表单
		     */
		    resetForm() { 
		       if(this.$refs['bannerForm']) {
		          this.$refs['bannerForm'].resetFields();
		       }
		       this.bannerForm.id = '';
		    },
			/* 编辑界面 */
			queryById(rowId){
				const _this = this;
				_this.axios.get('/ws/ops/banners/' + rowId).then(response => {
					var res = response.data;
					var resMeta = res.meta;
					if (0 === resMeta.code) {
						_this.bannerForm= res.data;
						if (_this.bannerForm.bannerType == 2) {
							_this.isShowUrl = 0;
						}
					} else {
						_this.$Message.warning(resMeta.message);
					}
				});
			},
			/**
			 * 新增
			 */
			saveDataDict() {
				const _this = this;
				if (null === _this.bannerForm.title.trim() || '' === _this.bannerForm.title.trim()) {
					_this.$Message.error('标题不能输入为空格');
					return ;
				}
				if (1 === _this.isShowUrl && '' === _this.bannerForm.url.trim()) {
					_this.$Message.error('url不能输入为空格');
					return ;
				}
				if (_this.bannerForm.bannerType == null) {
					_this.bannerForm.bannerType = 1;
				}
				let postData_ = _this.bannerForm;
				_this.axios.post('/ws/ops/banner', postData_).then(function(response) {
					let res = response.data;				
					if(0 === res.meta.code) {
						_this.$Message.success(res.meta.message);
						_this.goback();
					}else{
						let message_ = res.meta.message;
						_this.$Message.warning('新增失败:' + message_);
					}
				});
			},
			/**
			 * 编辑
			 */
			editDataDict() {
				const _this = this;
				if (null === _this.bannerForm.title.trim() || '' === _this.bannerForm.title.trim()) {
					_this.$Message.error('标题不能输入为空格');
					return ;
				}
				if (1 === _this.isShowUrl && '' === _this.bannerForm.url.trim()) {
					_this.$Message.error('url不能输入为空格');
					return ;
				}
				let postData_ = _this.bannerForm;
				this.axios.put('/ws/ops/banners', postData_).then(function(response) {
					let res = response.data;				
					if(0 === res.meta.code) {
						_this.$Message.success(res.meta.message);
						_this.goback();
					}else{
						let message_ = res.meta.message;
						_this.$Message.warning('编辑失败:' + message_);
					}
				});
			},
			/*条件插叙表单重置*/
			queryReset(){
				this.formInline = {
					name: ''
				}
			}
	  	}
	}
</script>

<style scoped>
	.ws-form-select {
		width: 80%;
	}
	.edit-button-self{
		margin: 20px;
	}
	#textFont {
		font-size: 20px;
	}
	.page-position {
		padding-left: 80%;
	}
</style>
